﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Reflection;
using System.Diagnostics;

namespace HeadLinx.AD.Explorer
{
    /// <summary>
    /// Interaction logic for AboutDialog.xaml
    /// </summary>
    public partial class AboutDialog : Window
    {
        public AboutDialog()
        {
            InitializeComponent();
            txtVersion.Text = "Version: " + Assembly.GetExecutingAssembly().GetName().Version.ToString();
        }

        private void btnClose_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void btnLinkMe_Click(object sender, RoutedEventArgs e)
        {
            string authorAlias = "v-donso";
            string self = LocalUtility.GetCurrentUserAlias();

            string names = String.Format("{0};{1}", self, authorAlias);
            LocalUtility.RunQueryAndShowResults(
                this,
                HeadLinx.AD.Common.HeadLinxQueryType.Arbitrary,
                names,
                "Link " + self + " with HeadLinx authors", false);
        }

        private void Hyperlink_Click(object sender, RoutedEventArgs e)
        {
            // Hyperlink.NavigateUri property does not work outside
            // of a navigation host, so we handle it explicitly here.
            Hyperlink link = (Hyperlink)sender;
            Process.Start(link.NavigateUri.ToString());
        }
    }
}
